package com.lfg.leetcode.leetcode1000;


public class No1014maxScoreSightseeingPair {
    public static void main(String[] args) {
        System.out.println(maxScoreSightseeingPair(new int[]{8, 1, 5, 2, 6}));
    }


    public static int maxScoreSightseeingPair(int[] values) {
        int max = 0;
        int ret = 0;

        for (int i = 0;i<values.length;i++) {
            int v = values[i] - i;
             ret = Math.max(ret,  v);
             max = Math.max(max, values[i] + i);
        }

        return ret;
    }
}

